﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using Jack.Service;

namespace ConsoleApplication2
{
    public class ClientCallBack : ICallBack
    {
        #region ICallBack 成员

        public void ReceiveTime(DateTime time)
        {
            Console.WriteLine("服务器收到消息的时间是：{0}", time.ToLongTimeString());
        }

        #endregion
    }

    public class ClientHello
    {
        private static IHello Channel
        { get; set; }

        private static ICallBack Callback
        { get; set; }
        public ClientHello()
        {
            Callback = new ClientCallBack();
            Channel = new DuplexChannelFactory<IHello>(Callback, "sessionservice").CreateChannel();      
        }
        public void SayHelloTo(string userName)
        {
            Channel.SayHelloTo(userName);
        }
    }

}
